

#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <math.h>

//int main()
//{
//	printf("hehe\n");
//}

int my_atoi(const char* str)
{
	assert(str);
	int count = 0;
	while (*str != '\0')
	{
		str++;
		count++;
	}
	str--;

	int i = 0;
	int sum = 0;
	for (i = 0; i < count; i++)
	{
		int val = 0;
		if ((*str >= 48) && (*str <= 57))
		{
			val = (*str - '0') * pow(10, i);
			sum += val;
			str--;
		}
	}
	return sum;
}

int main()
{
	int k = 0;
	char arr[] = "  1234";
	//int sz = sizeof(arr) / sizeof(arr[0]);
	k = my_atoi(arr);
	printf("%d\n", k);
}